<?php

class Test2Action extends Action{
	function checkNum(){
// 		print_r(1680%280);
	   $data['notify_data']="<notify><payment_type>1</payment_type><subject>名片</subject><trade_no>2017032521001004270230952843</trade_no><buyer_email>475650568@qq.com</buyer_email><gmt_create>2017-03-25 14:12:32</gmt_create><notify_type>trade_status_sync</notify_type><quantity>1</quantity><out_trade_no>109953998</out_trade_no><notify_time>2017-03-25 14:37:24</notify_time><seller_id>2088611832568237</seller_id><trade_status>TRADE_SUCCESS</trade_status><is_total_fee_adjust>N</is_total_fee_adjust><total_fee>0.01</total_fee><gmt_payment>2017-03-25 14:12:33</gmt_payment><seller_email>2727409946@qq.com</seller_email><price>0.01</price><buyer_id>2088502659772278</buyer_id><notify_id>b63b5e71cf353dfe3aef8b68f25d661i32</notify_id><use_coupon>N</use_coupon></notify>";
	     
	   var_dump($data['trade_no']);
	   
	   var_dump(parse_str('out_trade_no', $data));

	}
	
	function strPlac(){
	    Log::write("1111");
	    preg_match("/width='(.*?)'/i",
	        "<iframe width='512'  height=288 src='/Page/huyunvideo' frameborder=0 'allowfullscreen'></iframe>", $matches);
	    var_dump($matches);
	    $matche[1] = "400";
	    var_dump($matches);
	   /*  preg_match("/height='(.*?)'/i",
	        "<iframe width='512'  height='288' src='/Page/huyunvideo' frameborder=0 'allowfullscreen'></iframe>", $matches);
	    var_dump($matches); */
	    
	   var_dump( preg_replace("/iframe.+src/","iframe width='400' height='250' src","<iframe width='512'  height=288 src='/Page/huyunvideo' frameborder=0 'allowfullscreen'></iframe>"));
	    
	}
	
	function testarr() {
		// $re['buttons'] = array();
		$re ['name'] = 'Jack';
		$re ['sex'] = '1';
		
		$re ['buttons'] [] = 'Jack';
		$re ['buttons'] [] = 'wade';
		
		$re ['values'] [] = 'a';
		$re ['values'] [] = 'b';
		
		$json = json_encode ( $re );
		var_dump ( $re );
		
		foreach ( $re ['buttons'] as $key => $value ) {
			echo $key . ',' . $value;
		}
	}
	function getImg() {
		header ( 'content-type:image/jpg;' );
		// header('content-type:txt;'); //读取txt文件
		$content = file_get_contents ( 'd:\test.png' );
		echo $content;
	}
	
	//特殊商品支付
	function pay(){
		Vendor("WxPay.AutoLoad");
		$order_no = $_GET['osid'];
		$ob = M("csl_special_order");
		$info = $ob->where(array('osid'=>$order_no))->find();
		// 扫码支付  Begin -------------------------------------------------------
		$notify = new NativePay();
		$input = new WxPayUnifiedOrder();
		$input->SetBody("商品收款");
		$input->SetAttach("Att:".$order_no);
		$input->SetOut_trade_no($order_no); //正式环境取消rand函数
		$input->SetTotal_fee($info['order_price']*100);
		$input->SetTime_start(date("YmdHis"));
		$input->SetTime_expire(date("YmdHis", time() + 600));
		$input->SetGoods_tag("tag:".$order_no);
		$input->SetNotify_url("http://www.25mp.cn/OrderCheck/NotifySpecialOrder");
		$input->SetTrade_type("NATIVE");
		$input->SetProduct_id("Pid:".$order_no);
		$result = $notify->GetPayUrl($input);
		$url2 = $result["code_url"];
		
		$this->assign('info',$info);
		$this->assign('url',$url2);
		dayin($result);
// 		$this->display('Shop:orderpay');
	}
}
?>